import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const home = resolve => {
    require.ensure(['../pages/home.vue'], () => {
        resolve(require('../pages/home.vue'))
    })
}
const course = resolve => {
    require.ensure(['../pages/course.vue'], () => {
        resolve(require('../pages/course.vue'))
    })
}
const article = resolve => {
    require.ensure(['../pages/article.vue'], () => {
        resolve(require('../pages/article.vue'))
    })
}
const courseDetail = resolve => {
    require.ensure(['../pages/courseContent.vue'], () => {
        resolve(require('../pages/courseContent.vue'))
    })
}
const iviewDemo = resolve => {
    require.ensure(['../pages/iviewDemo.vue'], () => {
        resolve(require('../pages/iviewDemo.vue'))
    })
}

let routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        name: 'home',
        component: home
    },
    {
        path: '/iviewDemo',
        name: 'iviewDemo',
        component: iviewDemo
    },
    {
        path: '/course',
        name: 'course',
        component: course
    },
    {
        path: '/article',
        name: 'article',
        component: article
    },
    {
        path: '/courseDetail',
        name: 'courseDetail',
        component: courseDetail
    }
]

export default new Router({
    routes
})
